<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function f() {
            var hang = document.getElementById('h').value;
            var lie = document.getElementById('l').value;
            var data ="";
            for (var i = 0; i < hang; i++) {
                data+= "<tr>";
                for (var j = 0; j < lie; j++) {
                    data+= "<td style='width: 100px;height: 20px'>"+(i+1)+"--"+(j+1)+"</td>";
                }
                data+= "</tr>";
            }
            document.getElementById('bg').innerHTML += data;
        }
        function f1() {
            var h = document.getElementById("delh").value;
            var data ="";
            var arr = document.getElementsByTagName("tr");
            o:for (var i = 0; i < arr.length; i++) {
                if ((i+1)==h){
                    continue o;
                }
                data += "<tr>";
                data+=arr[i].innerHTML;
                data += "</tr>";
            }
            document.getElementById('bg').innerHTML = data;
        }
        function f2() {
            var l = document.getElementById('dell').value;
            var data ="";
            var arr = document.getElementsByTagName("tr");
            for (var i = 0; i < arr.length; i++) {
                var brr = arr[i].innerText.split("\t");
                data+="<tr>";
                o:for (var j = 0; j < brr.length; j++) {
                    var a = brr[j].split("--");
                    if (a[1]==l){
                        continue o;
                    }

                    data+="<td style='width: 100px;height: 20px'>"+brr[j]+"</td>"
                }
                data+="</tr>";
            }
            document.getElementById('bg').innerHTML = data;
        }
    </script>
</head>
<body>
    行:<input type="text" id="h">列:<input type="text" id="l"><button style="margin-left: 3px" onclick="f()">创建表格</button>
    <div style="border-top: 1px solid dimgray;;border-bottom: 1px solid dimgray;padding-top: 8px; padding-bottom:8px;width: 500px;margin-top: 8px;margin-bottom: 8px">
        <input type="text" id="delh"><button onclick="f1()">删除行</button>
        <br>
        <input type="text" id="dell"><button onclick="f2()">删除列</button>
    </div>
    <table id="bg" border='1' cellspacing='0' cellpadding='1'style="border-color: chartreuse">
    </table>
</body>
</html>